/* SPDX-License-Identifier: GPL-2.0 */
/*
 * VPMEM Numa Support
 *
 * Copyright (C) 2020 HUAWEI, Inc.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef _VPMEM_NUMA_H
#define _VPMEM_NUMA_H

#include <linux/types.h>

#define NR_VPMEM_NODE_MEMBLKS		(MAX_NUMNODES*2)

struct vpmem_entry {
	u64 start;		/* start of memory segment */
	u64 end;		/* end of memory segment */
	u32 numa;		/* memory segment affinity numa*/
};

struct vpmem_table {
	u32 nr_mem_entry;
	u32 nr_entry;
	struct vpmem_entry entry[NR_VPMEM_NODE_MEMBLKS];
	struct vpmem_entry mem_entry[NR_VPMEM_NODE_MEMBLKS];
};

struct vpmem_stat {
	u32 nr_node;
	u64 free[MAX_NUMNODES];
	u64 used[MAX_NUMNODES];
	u64 vpmem[MAX_NUMNODES];
	u64 total[MAX_NUMNODES];
	u64 os_free[MAX_NUMNODES];
	u64 resved_used[MAX_NUMNODES];
};

struct vpmem_table *vpmem_numa_init(void);

void vpmem_numa_table_debug(struct vpmem_table *table);

void vpmem_numa_get_stat(struct vpmem_table *table,
		struct vpmem_stat *stat);

#endif /* _VPMEM_NUMA_H */
